const mongoose = require("mongoose");
Schema = mongoose.Schema;
const heroSchema = new Schema({
  name: {
    type: String
  },
  //  注意
  icon: {
    type: String
  },
  title: {
    type: String
  },
  // 单个关联
  // category: {
  //   type: mongoose.SchemaTypes.ObjectId,
  //   reg: "category"
  // }
  // 多个关联
  categories: [
    {
      type: mongoose.SchemaTypes.ObjectId,
      ref: "category"
    }
  ],
  scores: {
    difficult: { type: Number },
    skills: { type: Number },
    attack: { type: Number },
    survive: { type: Number }
  },
  skills: [
    {
      icon: { type: String },
      name: { type: String },
      description: { type: String },
      tips: {
        type: String
      }
    }
  ],
  // 装备 关联
  items1: [
    {
      type: mongoose.SchemaTypes.ObjectId,
      ref: "category"
    }
  ],
  items1: [
    {
      type: mongoose.SchemaTypes.ObjectId,
      ref: "category"
    }
  ],
  usageTips: {
    type: String
  },
  battleTips: {
    type: String
  },
  teamTips: {
    type: String
  },
  parners: [
    {
      hero: {
        type: mongoose.SchemaTypes.ObjectId,
        ref: "hero"
      },
      description: {
        type: String
      }
    }
  ]
});

module.exports = mongoose.model("Hero", heroSchema);
